package com.ssy.lingxi.message.controller.mobile;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.message.model.vo.PushDeviceAddRequest;
import com.ssy.lingxi.message.service.IMobilePushMessageService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @menu APP - 消息推送设备接口
 * @author yzc
 * @version 2.0.0
 * @date 2020/10/27
 */
@RestController
@RequestMapping("/message/push/device")
public class MobilePushDeviceController extends BaseController {

    @Resource
    private IMobilePushMessageService mobilePushMessageService;

    /**
     * 添加推送设备
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping("/add")
    public Wrapper<Void> addPushDevice(@RequestBody @Validated PushDeviceAddRequest request) {
        return mobilePushMessageService.addPushDevice(request);
    }

    /**
     * 删除推送设备
     * @param request 接口参数
     * @return 返回结果
     */
    @PostMapping("/delete")
    public Wrapper<Void> deletePushDevice(@RequestBody @Validated PushDeviceAddRequest request) {
        return mobilePushMessageService.deletePushDevice(request);
    }
}

